package com.example.carapi.service.implement;

import com.example.carapi.bean.CarConfig;
import com.example.carapi.mapper.CarConfigMapper;
import com.example.carapi.service.CarConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CarConfigServiceImplement implements CarConfigService {
    @Autowired
    private CarConfigMapper carConfigMapper;

    @Override
    public CarConfig getCarConfigById(Long id) {
        return carConfigMapper.getOne(id);
    }

    @Override
    public List<CarConfig> getCarConfigs() {
        return carConfigMapper.getAll();
    }

    @Override
    public void addCarConfig(CarConfig carConfig) {
        carConfigMapper.insert(carConfig);
    }

    @Override
    public void updateCarConfig(CarConfig carConfig) {
        carConfigMapper.update(carConfig);
    }

    @Override
    public void deleteCarConfigById(Long id) {
        carConfigMapper.delete(id);
    }
}
